/*
 * @Author: dazy dazy916@126.com
 * @Date: 2025-09-18 11:22:23
 * @LastEditors: dazy dazy916@126.com
 * @LastEditTime: 2025-09-22 17:25:26
 * @FilePath: \H5\vite.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';

export default defineConfig({
  plugins: [vue()],
  optimizeDeps: {
    include: ['tracking']
  },
  base: '/xjwxx/',
  build: {
    target: 'es2015',
    outDir: 'dist',
    assetsDir: 'assets',
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
      // 添加 path 模块的浏览器兼容性处理
      path: 'path-browserify',
    },
  },
  server: {
    host: '0.0.0.0',
    port: '8027',
    open: true,
    cors: true,
    proxy: {
      '/jiucheng': {
        target: 'http://61.186.131.154:30060/v1',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/jiucheng/, '')
      },
      '/xjwxx/v1': {
        target: 'http://192.168.1.19:9012/xjwxx/v1',//'https://service.neucityai.com:30080/xjwxx/v1', //
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/xjwxx\/v1/, '')
      }
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        // additionalData: '@import "@/assets/style/base.scss";'
      }
    }
  }
})